﻿using Abp.Auditing;
using GN.Pay.Application.GatewayApp;
using GN.Pay.Application.GatewayApp.Dto.Output;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace GN.Pay.GatewayWeb.Controllers.PayRoute
{
    [PayRoute(Channel_Id)]
    class JYPayWebActionRoute : APayActionRoute
    {
        public const string Channel_Id = "YJPay.WebPay";

        public JYPayWebActionRoute(IClientInfoProvider clientInfo,
            ITradeApplyAppService service)
            : base(clientInfo, service)
        {

        }

        /// <summary>
        /// 
        /// </summary>
        public override string ChannelId
        {
            get
            {
                return Channel_Id;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        /// <param name="viewResultFactory"></param>
        /// <returns></returns>
        protected override ActionResult ViewResult(PayChannelOutput output, Func<string, object, ActionResult> viewResultFactory)
        {
            //var payModel = this.CreatePayPageModel(output.PayUrl, "post", output.PayParams);
            //return viewResultFactory("PayPage", payModel);
            string url = output.PayUrl + "?" + output.PayParams;
            return new RedirectResult(url);
        }
    }
}